<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body><?php
include_once '../Login/databaseconnection.php';

if(!loggedin())
{
	require_once '../index.php';
}
   
   else
   {
    $Competition_Id=$_SESSION['Competition_Id'];
    $School_Id=$_SESSION['School_Id'];
	   $Date=$_SESSION['Date'];
   
	
 $Competition_Id1=$_POST['Competition_Id'];
   $School_Id1=$_POST['School_Id'];
 $Competition_Name=$_POST['Competition_Name'];
    $No_Of_Students=$_POST['No_Of_Students'];
    $No_Of_Teachers=$_POST['No_Of_Teachers'];
    $Result=$_POST['Result'];
    $Date1=$_POST['Date'];
    $Scope=$_POST['Scope'];
   $Winner=$_POST['Winner'];
   if($Competition_Id1=="Select One"|| $School_Id1=="Select One"||$Competition_Name=="Select One"||$No_Of_Students=="Select One"||$No_Of_Teachers=="Select One"||$Result=="Select One"||$Date1=="Select One"||$Scope=="Select One"||$Winner=="Select One")
	{
		   $_SESSION['errorin']="Please check your inputs!";
	 
	}
	else
	{
	
$sql=mysql_query("UPDATE competition SET Competition_Id='$Competition_Id1',School_Id='$School_Id1',Competition_Name='$Competition_Name',No_Of_Students='$No_Of_Students',No_Of_Teachers='$No_Of_Teachers',Result='$Result',Date='$Date1',Scope='$Scope',Winner='$Winner' WHERE Competition_Id='$Competition_Id' AND School_Id='$School_Id' AND Date='$Date'");
unset($_SESSION['Competition_Id']);
unset($_SESSION['School_Id']);
if($sql)
  {
$_SESSION['error']="The record is successfully updated!";

  }

  if(!$sql)
  {
 $_SESSION['error']="Sorry unable to update this record!";
  

  }
	
}
}
  ?>
</body>
</html>
